==========================================================================
Photo Album Addon v2 for phpBB2 code changes
==========================================================================


v2.0.55a to v2.0.56 (compiled by sbourdon)

-> Number of pic(s) awaiting approval (if any) displayed on index page of each album (viewable by all or admins only)
	(http://smartor.is-root.com/viewtopic.php?t=16102)
-> FAQ added
	(http://smartor.is-root.com/viewtopic.php?t=14904)
-> "Last pic" in "Users Personal Galleries" displayed
	(http://smartor.is-root.com/viewtopic.php?t=12184)
-> Album speed-up removed (was causing problems with sort order on page 2 and up)
	(http://smartor.is-root.com/viewtopic.php?t=14191)
-> Redirection fixes (after deleting, moving, locking or unlocking a pic)
	(http://smartor.is-root.com/viewtopic.php?t=16128)
-> Sort by Username fixed (dropdown box would not keep this option selected)
-> Guest posting fix
-> GIF Thumbnailing fix
-> On member deletion, only pics from private galleries are deleted; pics in public categories are simply unlinked
	(http://smartor.is-root.com/viewtopic.php?t=15876)
-> On member deletion, comment usernames are unlinked (as if posted by guest)
	(http://smartor.is-root.com/viewtopic.php?t=15876)
-> phpBB login updated to comply with latest release
-> "All times..." displayed in album_page
-> "All times..." displayed in "Comments"
-> "Last Visit" displayed in "Users Personal Galleries"
-> No more white background on empty cells
	(http://smartor.is-root.com/viewtopic.php?t=14265)
-> Various template fixes

==========================================================================


### If phpbb_ is NOT your default table prefix, change it to yours in the following line
#
#----[ SQL ]-------------------------------------------
#
UPDATE `phpbb_album_config` SET `config_value` = '.0.56' WHERE `config_name` = 'album_version' LIMIT 1 ;


#
#----[ OPEN ]-------------------------------------------
#
language/lang_english/lang_main_album.php

#
#----[ FIND ]------------------------------------------- (X pic(s) awaiting approval)
#
$lang['Pic_Title'] = 'Pic Title';

#
#----[ AFTER ADD ]--------------------------------- (X pic(s) awaiting approval)
#
$lang['Waiting'] = ' pic(s) waiting for approval';

#
#----[ OPEN ]-------------------------------------------
#
language/lang_english/lang_faq.php

#
#----[ FIND ]------------------------------------------- (FAQ)
#
//
// These entries should remain in all languages and for all modifications
//

#
#----[ BEFORE ADD ]--------------------------------- (FAQ)
#
//
//Photo Albums
//
$faq[] = array("--","Photo Album");
$faq[] = array("How do I access the Photo Album?","Simply use the link 'Photo Album' at the top of the page. This will take you to the main Photo Album directory where all public Photo Albums are displayed. You can also access an individual's Personal Photo Gallery by clicking the link 'Users Personal Galleries' below the Public Categories.");
$faq[] = array("How do I upload a picture to a Photo Album?","Once you are on the main Photo Album index page, select either one of the 'Public Categories' or 'Users Personal Galleries'. You should now see a button that says 'Upload Pic' at the top and bottom of the page. Click this button and follow the instructions on the following page.");
$faq[] = array("What are the maximum file size, maximum image width and maximum image height allowed?","These settings appear on the 'Upload Pic' page. The board administrator sets an upper limit for filesize, defined file extensions and other things for uploaded pictures in the Albums.");
$faq[] = array("What format does my picture have to be in?","These settings appear on the 'Upload Pic' page. The board administrator sets an upper limit for filesize, defined file extensions and other things for uploaded pictures in the Albums.");
$faq[] = array("I still can't get my picture to upload; I keep getting an error message!","Go back to the 'Upload Pic' page and make sure you are following all of the directions there. The file you are trying to upload may be bigger than the Maximum file size allowed, you may be trying to upload a pic that does not fit the dimensions specified, you may be trying to upload a pic in a format not available, or you simply may have forgotten to fill in the necessary fields for the pic to post correctly.");
$faq[] = array("I made a mistake in the title and/or description of my picture. What can I do?","When viewing an Album, there are several options available to users. If the board administrator has allowed it, you will find the link 'Edit' below each thumbnail which will allow you to alter this information at any time.");
$faq[] = array("How do I delete a pic?","When viewing an Album, there are several options available to users. If the board administrator has allowed it, you will find the link 'Delete' below each thumbnail which will allow you to remove any picture of your own.");
$faq[] = array("I would like to let someone know how much I like or dislike their picture. How do I do that?","When viewing an Album or a pic, there are several options available to users. If the board administrator has allowed it, you will find the links 'Rating' and 'Comments' below each thumbnail or picture which allow you to do this in a couple of ways at any time.");

#
#----[ OPEN ]-------------------------------------------
#
album_cat.php

#
#----[ FIND ]------------------------------------------- (Album Speed-Up fix)
#
if( isset($HTTP_GET_VARS['sort_method']) )
{
   switch ($HTTP_GET_VARS['sort_method'])
   {
   case 'pic_time':
         $sort_method = 'p.pic_time';
         break;
      case 'pic_title':
         $sort_method = 'p.pic_title';
         break;
      case 'username':
         $sort_method = 'u.username';
         break;
      case 'pic_view_count':
         $sort_method = 'p.pic_view_count';
         break;
      case 'rating':
         $sort_method = 'rating';
         break;
      case 'comments':
         $sort_method = 'comments';
         break;
      case 'new_comment':
         $sort_method = 'new_comment';
         break;
      default:
         $sort_method = $album_config['sort_method'];
   }
}
else if( isset($HTTP_POST_VARS['sort_method']) )
{
   switch ($HTTP_POST_VARS['sort_method'])
   {
      case 'pic_time':
         $sort_method = 'p.pic_time';
         break;
      case 'pic_title':
         $sort_method = 'p.pic_title';
         break;
      case 'username':
         $sort_method = 'u.username';
         break;
      case 'pic_view_count':
         $sort_method = 'p.pic_view_count';
         break;
      case 'rating':
         $sort_method = 'rating';
         break;
      case 'comments':
         $sort_method = 'comments';
         break;
      case 'new_comment':
         $sort_method = 'new_comment';
         break;
      default:
         $sort_method = $album_config['sort_method'];
   }
}

#
#----[ REPLACE WITH ]--------------------------------- (Album Speed-Up fix)
#
if( isset($HTTP_GET_VARS['sort_method']) )
{
	switch ($HTTP_GET_VARS['sort_method'])
	{
		case 'pic_time':
			$sort_method = 'pic_time';
			break;
		case 'pic_title':
			$sort_method = 'pic_title';
			break;
		case 'username':
			$sort_method = 'username';
			break;
		case 'pic_view_count':
			$sort_method = 'pic_view_count';
			break;
		case 'rating':
			$sort_method = 'rating';
			break;
		case 'comments':
			$sort_method = 'comments';
			break;
		case 'new_comment':
			$sort_method = 'new_comment';
			break;
		default:
			$sort_method = $album_config['sort_method'];
	}
}
elseif( isset($HTTP_POST_VARS['sort_method']) )
{
	switch ($HTTP_POST_VARS['sort_method'])
	{
		case 'pic_time':
			$sort_method = 'pic_time';
			break;
		case 'pic_title':
			$sort_method = 'pic_title';
			break;
		case 'username':
			$sort_method = 'username';
			break;
		case 'pic_view_count':
			$sort_method = 'pic_view_count';
			break;
		case 'rating':
			$sort_method = 'rating';
			break;
		case 'comments':
			$sort_method = 'comments';
			break;
		case 'new_comment':
			$sort_method = 'new_comment';
			break;
		default:
			$sort_method = $album_config['sort_method'];
	}
}

#
#----[ FIND ]------------------------------------------- (Redirection fix)
#
if (empty($thiscat))
{
	message_die(GENERAL_MESSAGE, $lang['Category_not_exist']);
}
//
// END cat info
//


// ------------------------------------
// Check permissions
// ------------------------------------
if( !$auth_data['view'] )
{
	if (!$userdata['session_logged_in'])
	{
		redirect(append_sid("login.$phpEx?redirect=album_cat.$phpEx&amp;cat_id=$cat_id"));
	}
	else
	{
		message_die(GENERAL_ERROR, $lang['Not_Authorised']);
	}
}
//
// END check permissions
//

#
#----[ REPLACE WITH ]--------------------------------- (Redirection fix)
#
//
// END cat info
//


// ------------------------------------
// Check permissions
// ------------------------------------
if( !$auth_data['view'] )
{
	if (!$userdata['session_logged_in'])
	{
		redirect(append_sid("login.$phpEx?redirect=album_cat.$phpEx&cat_id=$cat_id"));
	}
	else
	{
		message_die(GENERAL_ERROR, $lang['Not_Authorised']);
	}
}
//
// END check permissions
//


if (empty($thiscat))
{
	message_die(GENERAL_MESSAGE, $lang['Category_not_exist']);
}

#
#----[ FIND ]------------------------------------------- (X pic(s) awaiting approval)
#
	$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, p.pic_lock, p.pic_approval, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, MAX(c.comment_id) as new_comment

#
#----[ BEFORE ADD ]--------------------------------- (X pic(s) awaiting approval)
#
	$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, p.pic_lock, p.pic_approval, u.user_id , u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments, MAX(c.comment_id) as new_comment
		FROM ". ALBUM_TABLE ." AS p
			LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
			LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
			LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
		WHERE p.pic_cat_id = '$cat_id'
		GROUP BY p.pic_id
		ORDER BY $sort_method $sort_order
		LIMIT $limit_sql";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query pics information', '', __LINE__, __FILE__, $sql);
	}

	$picrow = array();

	while( $row = $db->sql_fetchrow($result) )
	{
		$picrow[] = $row;
	}

	$tot_unapproved = 0;
	for ($i = 0 ; $i < count($picrow); $i++ )
	{
		if ($picrow[$i]['pic_approval'] == 0 )
		{
			$tot_unapproved++;
		}
	}

#
#----[ FIND ]------------------------------------------- (X pic(s) awaiting approval)
#
	'L_NO_PICS' => $lang['No_Pics'],

### If you want the number of pics awaiting approval to be viewable by all visitors (default), use the following and then proceed to the next FIND statement
#
#----[ AFTER ADD ]--------------------------------- (X pic(s) awaiting approval)
#
	'WAITING' => ($tot_unapproved == 0) ? "" : $tot_unapproved . $lang['Waiting'],

### If you want the number of pics awaiting approval to be viewable ONLY by admins, do NOT use the previous line but the following instead
#
#----[ AFTER ADD ]--------------------------------- (X pic(s) awaiting approval)
#
	$waiting = ($tot_unapproved == 0) ? "" : $tot_unapproved . $lang['Waiting'],
	'WAITING' => ( $userdata['user_level'] == ADMIN ) ? $waiting : "",

#
#----[ FIND ]------------------------------------------- (Background fix)
#
			if( $j >= count($picrow) )
			{
				break;
			}

#
#----[ REPLACE WITH ]--------------------------------- (Background fix)
#
			if( $j >= count($picrow) )
			{
				$template->assign_block_vars('picrow.nopiccol', array());
				$template->assign_block_vars('picrow.picnodetail', array());
				continue;
			}

#
#----[ FIND ]------------------------------------------- (Sort by Username fix)
#
	'SORT_USERNAME' => ($sort_method == 'pic_user_id') ? 'selected="selected"' : '',

#
#----[ REPLACE WITH ]--------------------------------- (Sort by Username fix)
#
	'SORT_USERNAME' => ($sort_method == 'username') ? 'selected="selected"' : '',

#
#----[ OPEN ]-------------------------------------------
#
album.php

#
#----[ FIND ]------------------------------------------- (Guest posting fix)
#
			$last_pic_info .= ($lastrow['pic_username'] == '') ? $lang['Guest'] : $lastrow['pic_username'];

#
#----[ REPLACE WITH ]--------------------------------- (Guest posting fix)
#
			$last_pic_info .= ($lastrow['pic_username'] == '') ? $lang['Poster'] . ':&nbsp;' . $lang['Guest'] : $lastrow['pic_username'];

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_cat_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
	<td align="right" valign="bottom" nowrap="nowrap"><span class="nav">{PAGINATION}</span></td>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
	<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>

#
#----[ FIND ]------------------------------------------- (X pic(s) awaiting approval)
#
	<td class="nav" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_ALBUM}">{L_ALBUM}</a> -> <a class="nav" href="{U_VIEW_CAT}">{CAT_TITLE}</a></span></td>

#
#----[ AFTER ADD ]--------------------------------- (X pic(s) awaiting approval)
#
	<td align="right" valign="bottom" nowrap="nowrap"><span class="mainmenu"><font color="red"><b>{WAITING}</b></font></span></td>

#
#----[ FIND ]------------------------------------------- (Background fix)
#
  <!-- END piccol -->

#
#----[ AFTER ADD ]--------------------------------- (Background fix)
#
	<!-- BEGIN nopiccol -->
	<td align="center" width="{S_COL_WIDTH}" class="row1">&nbsp;</span></td>
	<!-- END nopiccol -->

#
#----[ FIND ]------------------------------------------- (Background fix)
#
  <!-- END pic_detail -->

#
#----[ AFTER ADD ]--------------------------------- (Background fix)
#
	<!-- BEGIN picnodetail -->
	<td class="row2">&nbsp;</td>
	<!-- END picnodetail -->

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_index_body.tpl

#
#-----[ FIND ]------------------------------------------ (phpBB update)
#
		<input class="post" type="password" name="password" size="10" />
		&nbsp;&nbsp; &nbsp;&nbsp;{L_AUTO_LOGIN}
		<input class="text" type="checkbox" name="autologin" />

#
#-----[ REPLACE WITH ]------------------------------------------ (phpBB update)
#
		<input class="post" type="password" name="password" size="10" maxlength="32" />
		<!-- BEGIN switch_allow_autologin -->
		&nbsp;&nbsp; &nbsp;&nbsp;{L_AUTO_LOGIN}
		<input class="text" type="checkbox" name="autologin" />
		<!-- END switch_allow_autologin -->

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/album_page_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#-----[ FIND ]------------------------------------------------ ("All times..." in album_page)
#
<br />

<!--
You must keep my copyright notice visible with its original content
-->

#
#-----[ BEFORE ADD ]------------------------------------------ ("All times..." in album_page)
#
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
	<tr>
		<td align="right" valign="middle" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span></td>
	</tr>
</table>

#
#-----[ OPEN ]------------------------------------------
#
album_personal.php

#
#----[ FIND ]------------------------------------------- (Background fix)
#
			if( $j >= count($picrow) )
			{
				break;
			}

#
#----[ REPLACE WITH ]--------------------------------- (Background fix)
#
			if( $j >= count($picrow) )
			{
				$template->assign_block_vars('picrow.nopiccol', array());
				$template->assign_block_vars('picrow.picnodetail', array());
				continue;
			}

#
#-----[ OPEN ]------------------------------------------
#
album_personal_index.php

#
#-----[ FIND ]------------------------------------------ ("Last pic" in "Users Personal Galleries")
#
	'L_SORT' => $lang['Sort'],

#
#-----[ AFTER ADD ]------------------------------------------ ("Last pic" in "Users Personal Galleries")
#
	'L_LAST_PIC_DATE' => $lang['Last_Pic'],

#
#-----[ FIND ]------------------------------------------ ("Last pic" in "Users Personal Galleries")
#
$sql = "SELECT u.username, u.user_id, u.user_regdate, COUNT(p.pic_id) AS pics, MAX(p.pic_id) AS last_pic
		FROM ". USERS_TABLE ." AS u, ". ALBUM_TABLE ." as p
		WHERE u.user_id <> ". ANONYMOUS ."
			AND u.user_id = p.pic_user_id
			AND p.pic_cat_id = ". PERSONAL_GALLERY ."
		GROUP BY user_id
		ORDER BY $order_by";

if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}

$memberrow = array();

while( $row = $db->sql_fetchrow($result) )
{
	$memberrow[] = $row;
}

for ($i = 0; $i < count($memberrow); $i++)
{
	$template->assign_block_vars('memberrow', array(
		'ROW_CLASS' => ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'],
		'USERNAME' => $memberrow[$i]['username'],
		'U_VIEWGALLERY' => append_sid("album_personal.$phpEx?user_id=". $memberrow[$i]['user_id']),
		'JOINED' => create_date($lang['DATE_FORMAT'], $memberrow[$i]['user_regdate'], $board_config['board_timezone']),
		'PICS' => $memberrow[$i]['pics'])
	);
}

#
#-----[ REPLACE WITH ]------------------------------------------ ("Last pic" in "Users Personal Galleries")
#
$sql = "SELECT u.username, u.user_id, u.user_regdate, MAX(p.pic_id) as pic_id, p.pic_title, p.pic_user_id, COUNT(p.pic_id) AS pics, MAX(p.pic_time) as pic_time
		FROM ". USERS_TABLE ." AS u, ". ALBUM_TABLE ." as p
		WHERE u.user_id <> ". ANONYMOUS ."
			 AND u.user_id = p.pic_user_id
			 AND p.pic_cat_id = ". PERSONAL_GALLERY ."
		GROUP BY user_id
		ORDER BY $order_by";

if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}

$memberrow = array();

while( $row = $db->sql_fetchrow($result) )
{
	$memberrow[] = $row;
}


for ($i = 0; $i < count($memberrow); $i++)
{
	$pic_number = $memberrow[$i]['pics'];
	$pic_id = $memberrow[$i]['pic_id'];
	$sql = "SELECT *
		FROM ". ALBUM_TABLE ."
		WHERE pic_id = '$pic_id'";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query pic information', '', __LINE__, __FILE__, $sql);
	}
	$thispic = $db->sql_fetchrow($result);

	$pic_title = $thispic['pic_title'];

	if( !isset($album_config['last_pic_title_length']) )
	{
		$album_config['last_pic_title_length'] = 50;
	}
	$pic_title_full = $pic_title;
	if (strlen($pic_title) > $album_config['last_pic_title_length'])
	{
		$pic_title = substr($pic_title, 0, $album_config['last_pic_title_length']) . '...';
	}

	$last_pic_info = '<br />'. $lang['Pic_Title'] .': <a href="';

	$last_pic_info .= ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $pic_id) .'" title="' . $pic_title_full . '" target="_blank">' : append_sid("album_page.$phpEx?pic_id=". $pic_id) .'" title="' . $pic_title_full . '">' ;

	$last_pic_info .= $pic_title .'</a>';

	$template->assign_block_vars('memberrow', array(
		'ROW_CLASS' => ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'],
		'USERNAME' => $memberrow[$i]['username'],
		'U_VIEWGALLERY' => append_sid("album_personal.$phpEx?user_id=". $memberrow[$i]['user_id']),
		'JOINED' => create_date($lang['DATE_FORMAT'], $memberrow[$i]['user_regdate'], $board_config['board_timezone']),
		'LAST_PIC' => create_date($board_config['default_dateformat'], $memberrow[$i]['pic_time'], $board_config['board_timezone']) . $last_pic_info,
		'PICS' => $pic_number
		)
	);
}

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_personal_index_body.tpl

#
#-----[ FIND ]------------------------------------------ ("Last Visit" in "Users Personal Galleries")
#
	  <td><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a href="{U_ALBUM}" class="nav">{L_ALBUM}</a></span></td>

#
#-----[ REPLACE WITH ]------------------------------------------ ("Last Visit" in "Users Personal Galleries")
#
<td><span class="gensmall">
	<!-- BEGIN switch_user_logged_in -->
	{LAST_VISIT_DATE}<br />
	<!-- END switch_user_logged_in -->
	{CURRENT_TIME}<br />
<span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a href="{U_ALBUM}" class="nav">{L_ALBUM}</a></span></td>

#
#-----[ FIND ]------------------------------------------ ("Last Pic" in "Users Personal Galleries")
#
	  <th width="100%" height="25" nowrap="nowrap" class="thCornerL">&nbsp;{L_USERS_PERSONAL_GALLERIES}&nbsp;</th>
	  <th class="thTop" nowrap="nowrap">&nbsp;{L_JOINED}&nbsp;</th>
	  <th class="thCornerR" nowrap="nowrap">&nbsp;{L_PICS}&nbsp;</th>

#
#-----[ REPLACE WITH ]------------------------------------------ ("Last Pic" in "Users Personal Galleries")
#
		<th width="60%" height="25" nowrap="nowrap" class="thCornerL">&nbsp;{L_USERS_PERSONAL_GALLERIES}&nbsp;</th>
		<th width="10%" class="thTop" nowrap="nowrap">&nbsp;{L_JOINED}&nbsp;</th>
		<th width="60" class="thTop" nowrap="nowrap">&nbsp;{L_PICS}&nbsp;</th>
		<th class="thCornerR" nowrap="nowrap">&nbsp;{L_LAST_PIC_DATE}&nbsp;</th>

#
#-----[ FIND ]------------------------------------------ ("Last Pic" in "Users Personal Galleries")
#
	  <td class="{memberrow.ROW_CLASS}" align="center"><span class="gensmall">{memberrow.PICS}</span></td>

#
#-----[ AFTER ADD ]------------------------------------------ ("Last Pic" in "Users Personal Galleries")
#
		<td class="{memberrow.ROW_CLASS}" align="center" nowrap="nowrap"><span class="gensmall">&nbsp;{memberrow.LAST_PIC}&nbsp;</span></td>

#
#-----[ FIND ]------------------------------------------ ("Last Pic" in "Users Personal Galleries")
#
	  <td class="catBottom" colspan="3" height="28">&nbsp;</td>

#
#-----[ REPLACE WITH ]------------------------------------------ ("Last Pic" in "Users Personal Galleries")
#
		<td class="catBottom" colspan="4" height="28">&nbsp;</td>

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_personal_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
	<!-- BEGIN your_personal_gallery -->
	<td><a href="{U_UPLOAD_PIC}"><img src="{UPLOAD_PIC_IMG}" border="0" alt="{L_UPLOAD_PIC}" title="{L_UPLOAD_PIC}" /></a></td>
	<!-- END your_personal_gallery -->
	<td class="nav" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_ALBUM}">{L_ALBUM}</a> -> <a class="nav" href="{U_PERSONAL_GALLERY}">{L_PERSONAL_GALLERY_OF_USER}</a></span></td>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
	<!-- BEGIN your_personal_gallery -->
	<td><a href="{U_UPLOAD_PIC}"><img src="{UPLOAD_PIC_IMG}" border="0" alt="{L_UPLOAD_PIC}" title="{L_UPLOAD_PIC}" /></a>&nbsp;&nbsp;&nbsp;</td>
	<!-- END your_personal_gallery -->
	<td class="nav" width="100%"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_ALBUM}">{L_ALBUM}</a> -> <a class="nav" href="{U_PERSONAL_GALLERY}">{L_PERSONAL_GALLERY_OF_USER}</a></span></td>

#
#----[ FIND ]------------------------------------------- (Template fix)
#
	<!-- BEGIN your_personal_gallery -->
	<td><a href="{U_UPLOAD_PIC}"><img src="{UPLOAD_PIC_IMG}" border="0" alt="{L_UPLOAD_PIC}" title="{L_UPLOAD_PIC}" /></a></td>
	<!-- END your_personal_gallery -->
	<td width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_ALBUM}">{L_ALBUM}</a> -> <a class="nav" href="{U_PERSONAL_GALLERY}">{L_PERSONAL_GALLERY_OF_USER}</a></span></td>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
	<!-- BEGIN your_personal_gallery -->
	<td><a href="{U_UPLOAD_PIC}"><img src="{UPLOAD_PIC_IMG}" border="0" alt="{L_UPLOAD_PIC}" title="{L_UPLOAD_PIC}" /></a>&nbsp;&nbsp;&nbsp;</td>
	<!-- END your_personal_gallery -->
	<td width="100%"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_ALBUM}">{L_ALBUM}</a> -> <a class="nav" href="{U_PERSONAL_GALLERY}">{L_PERSONAL_GALLERY_OF_USER}</a></span></td>

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ FIND ]------------------------------------------- (Background fix)
#
  <!-- END piccol -->

#
#----[ AFTER ADD ]--------------------------------- (Background fix)
#
	<!-- BEGIN nopiccol -->
	<td align="center" width="{S_COL_WIDTH}" class="row1">&nbsp;</span></td>
	<!-- END nopiccol -->

#
#----[ FIND ]------------------------------------------- (Background fix)
#
  <!-- END pic_detail -->

#
#----[ AFTER ADD ]--------------------------------- (Background fix)
#
	<!-- BEGIN picnodetail -->
	<td class="row2">&nbsp;</td>
	<!-- END picnodetail -->

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_comment_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
		  <td align="right" valign="top" class="genmed" nowrap="nowrap"><b>{L_PIC_TITLE}:</b></td>
		  <td valign="top" class="genmed" width="100%">{PIC_TITLE}</td>
		</tr>
		<tr>
		  <td align="right" valign="top" class="genmed" nowrap="nowrap"><b>{L_PIC_DESC}:</b></td>
		  <td valign="top" class="genmed">{PIC_DESC}</td>
		</tr>
		<tr>
		  <td align="right" valign="top" class="genmed" nowrap="nowrap"><b>{L_POSTER}:</b></td>
		  <td valign="top" class="genmed">{POSTER}</td>
		</tr>
		<tr>
		  <td align="right" valign="top" class="genmed" nowrap="nowrap"><b>{L_POSTED}:</b></td>
		  <td valign="top" class="genmed">{PIC_TIME}</td>
		</tr>
		<tr>
		  <td align="right" valign="top" class="genmed" nowrap="nowrap"><b>{L_VIEW}:</b></td>
		  <td valign="top" class="genmed">{PIC_VIEW}</td>
		</tr>
		<tr>
		  <td align="right" valign="top" class="genmed" nowrap="nowrap"><b>{L_COMMENTS}:</b></td>
		  <td valign="top" class="genmed">{PIC_COMMENTS}</td>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
			<td align="right" valign="top" class="genmed" nowrap="nowrap">{L_PIC_TITLE}:</td>
			<td valign="top" class="genmed" width="100%"><b>{PIC_TITLE}</b></td>
		</tr>
		<tr>
			<td align="right" valign="top" class="genmed" nowrap="nowrap">{L_PIC_DESC}:</td>
			<td valign="top" class="genmed"><b>{PIC_DESC}</b></td>
		</tr>
		<tr>
			<td align="right" valign="top" class="genmed" nowrap="nowrap">{L_POSTER}:</td>
			<td valign="top" class="genmed"><b>{POSTER}</b></td>
		</tr>
		<tr>
			<td align="right" valign="top" class="genmed" nowrap="nowrap">{L_POSTED}:</td>
			<td valign="top" class="genmed"><b>{PIC_TIME}</b></td>
		</tr>
		<tr>
			<td align="right" valign="top" class="genmed" nowrap="nowrap">{L_VIEW}:</td>
			<td valign="top" class="genmed"><b>{PIC_VIEW}</b></td>
		</tr>
		<tr>
			<td align="right" valign="top" class="genmed" nowrap="nowrap">{L_COMMENTS}:</td>
			<td valign="top" class="genmed"><b>{PIC_COMMENTS}</b></td>

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#-----[ FIND ]------------------------------------------------ ("All times..." in "Comments")
#
<!-- BEGIN switch_comment -->
<table width="100%" cellspacing="2" border="0" cellpadding="2">
  <tr>
	<td width="100%"><span class="nav">{PAGE_NUMBER}</span></td>
	<td align="right" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
  </tr>
</table>
<!-- END switch_comment -->

#
#-----[ REPLACE WITH ]----------------------------------------- ("All times..." in "Comments")
#
<table width="100%" cellspacing="2" border="0" cellpadding="2">
	<tr>
		<td width="100%"><span class="nav">{PAGE_NUMBER}</span></td>
		<td align="right" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br />
		<!-- BEGIN switch_comment -->
		<span class="nav">{PAGINATION}</span>
		<!-- END switch_comment -->
		</td>
	</tr>
</table>

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_edit_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_modcp_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<table width="100%" cellspacing="2" border="0" cellpadding="2">
  <tr>
	<td align="right" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br />
		<span class="nav">{PAGINATION}</span></td>
  </tr>
  <tr>
	<td colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
  </tr>
</table>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
	<tr>
		<td align="left" valign="middle"><span class="nav">{PAGE_NUMBER}</span></td>
		<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
	</tr>
</table>

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_move_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_rate_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ OPEN ]-------------------------------------------
#
templates/subSilver/album_upload_body.tpl

#
#----[ FIND ]------------------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2003 <a href="http://smartor.is-root.com" target="_blank">Smartor</a></div>

#
#----[ REPLACE WITH ]--------------------------------- (Template fix)
#
<div align="center" class="copyright">Powered by Photo Album {ALBUM_VERSION} &copy; 2002-2007 <a href="http://smartor.is-root.com" target="_blank" class="copyright">Smartor</a></div>

#
#----[ OPEN ]-------------------------------------------
#
album_comment.php

#
#----[ FIND ]------------------------------------------- (Redirection fix)
#
// ------------------------------------
// Check the permissions
// ------------------------------------

$auth_data = album_user_access($cat_id, $thiscat, 1, 0, 0, 1, 1, 1);

if ($auth_data['view'] == 0)
{
	if (!$userdata['session_logged_in'])
	{
		redirect(append_sid("login.$phpEx?redirect=album_comment.$phpEx&amp;pic_id=$pic_id"));

#
#----[ REPLACE WITH ]--------------------------------- (Redirection fix)
#
// ------------------------------------
// Check the permissions
// ------------------------------------

$auth_data = album_user_access($cat_id, $thiscat, 1, 0, 0, 1, 1, 1);

if ($auth_data['view'] == 0)
{
	if (!$userdata['session_logged_in'])
	{
		redirect(append_sid("login.$phpEx?redirect=album_comment.$phpEx&pic_id=$pic_id"));

#
#----[ FIND ]------------------------------------------- (Redirection fix)
#
	// ------------------------------------
	// Check the permissions: COMMENT
	// ------------------------------------

	if ($auth_data['comment'] == 0)
	{
		if (!$userdata['session_logged_in'])
		{
			redirect(append_sid("login.$phpEx?redirect=album_comment.$phpEx&amp;pic_id=$pic_id"));

#
#----[ REPLACE WITH ]--------------------------------- (Redirection fix)
#
	// ------------------------------------
	// Check the permissions: COMMENT
	// ------------------------------------

	if ($auth_data['comment'] == 0)
	{
		if (!$userdata['session_logged_in'])
		{
			redirect(append_sid("login.$phpEx?redirect=album_comment.$phpEx&pic_id=$pic_id"));

#
#----[ OPEN ]-------------------------------------------
#
album_edit.php

#
#----[ FIND ]------------------------------------------- (Redirection fix)
#
	{
		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("album_personal.$phpEx") . '">')
		);

		$message .= "<br /><br />" . sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx") . "\">", "</a>");
	}

#
#----[ REPLACE WITH ]--------------------------------- (Redirection fix)
#
	{
		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("album_personal.$phpEx?user_id=$user_id") . '">')
		);

		$message .= "<br /><br />" . sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx?user_id=$user_id") . "\">", "</a>");
	}

#
#----[ OPEN ]-------------------------------------------
#
album_delete.php

#
#----[ FIND ]------------------------------------------- (Redirection fix)
#
		redirect(append_sid("album_cat.$phpEx?cat_id=$cat_id"));
		exit;

#
#----[ REPLACE WITH ]--------------------------------- (Redirection fix)
#
		if ($cat_id)
		{
			redirect(append_sid("album_cat.$phpEx?cat_id=$cat_id"));
		}
		else
		{
			redirect(append_sid("album_personal.$phpEx?user_id=$user_id"));
		}
		exit;

#
#----[ FIND ]------------------------------------------- (Redirection fix)
#
	{
		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("album_personal.$phpEx") . '">')
		);

		$message .= "<br /><br />" . sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx") . "\">", "</a>");
	}

#
#----[ REPLACE WITH ]--------------------------------- (Redirection fix)
#
	{
		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("album_personal.$phpEx?user_id=$user_id") . '">')
		);

		$message .= "<br /><br />" . sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx?user_id=$user_id") . "\">", "</a>");
	}

#
#----[ OPEN ]-------------------------------------------
#
album_modcp.php

#
#-----[ FIND ]---------------------------------------- (Redirection fix)
#
			$message .= sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx") . "\">", "</a>");

#
#-----[ REPLACE WITH ]---------------------------------------- (Redirection fix)
#
			$message .= sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx?user_id=$user_id") . "\">", "</a>");

#
#-----[ FIND ]---------------------------------------- (Redirection fix)
#
			$message .= sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx") . "\">", "</a>");

#
#-----[ REPLACE WITH ]---------------------------------------- (Redirection fix)
#
			$message .= sprintf($lang['Click_return_personal_gallery'], "<a href=\"" . append_sid("album_personal.$phpEx?user_id=$user_id") . "\">", "</a>");

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php

#
#-----[ FIND ]------------------------------------------ (Update of Album / comment usernames on member deletion)
#
      $sql = "SELECT pic_filename, pic_thumbnail
        FROM " . ALBUM_TABLE . "
        WHERE pic_user_id = $user_id";
      if( !($result = $db->sql_query($sql)) )
      {
        message_die(GENERAL_ERROR, 'Could not obtain album information for this user', '', __LINE__, __FILE__, $sql);
      }
      while ($row = $db->sql_fetchrow($result))
      {
        @unlink('../' . ALBUM_UPLOAD_PATH . $row['pic_filename']);
        @unlink('../' . ALBUM_CACHE_PATH . $row['pic_thumbnail']);
      }
      $sql = "DELETE
        FROM " . ALBUM_TABLE . "
        WHERE pic_user_id = $user_id";
      if( !($result = $db->sql_query($sql)) )
      {
        message_die(GENERAL_ERROR, 'Could not delete album information for this user', '', __LINE__, __FILE__, $sql);
      }

#
#-----[ REPLACE WITH ]------------------------------------------ (Update of Album / comment usernames on member deletion)
#
			$sql = "SELECT pic_filename, pic_thumbnail
				FROM " . ALBUM_TABLE . "
					WHERE pic_user_id = $user_id
					AND pic_cat_id = 0";
			if( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain album information for this user', '', __LINE__, __FILE__, $sql);
			}
			while ($row = $db->sql_fetchrow($result))
			{
				@unlink('../' . ALBUM_UPLOAD_PATH . $row['pic_filename']);
				@unlink('../' . ALBUM_CACHE_PATH . $row['pic_thumbnail']);
			}
			$sql = "DELETE
				FROM " . ALBUM_TABLE . "
					WHERE pic_user_id = $user_id
					AND pic_cat_id = 0";
			if( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not delete album information for this user', '', __LINE__, __FILE__, $sql);
			}

			$sql = "UPDATE " . ALBUM_TABLE . "
			SET pic_user_id = -1
				WHERE pic_user_id = $user_id";
			if( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not update album information for this user', '', __LINE__, __FILE__, $sql);
			}

			$sql = "UPDATE " . ALBUM_COMMENT_TABLE . "
			SET comment_user_id = -1
				WHERE comment_user_id = $user_id";
			if( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not update album comment information for this user', '', __LINE__, __FILE__, $sql);
			}

#
#----[ OPEN ]-------------------------------------------
#
album_upload.php

#
#-----[ FIND ]---------------------------------------- (GIF Thumbnailing fix)
#
	if( ($album_config['thumbnail_cache'] == 1) and ($pic_filetype != '.gif') and ($album_config['gd_version'] > 0) )
	{
		$gd_errored = FALSE;

		switch ($pic_filetype)
		{
			case '.jpg':
				$read_function = 'imagecreatefromjpeg';
				break;
			case '.png':
				$read_function = 'imagecreatefrompng';
				break;
		}

#
#-----[ REPLACE WITH ]------------------------------------------ (GIF Thumbnailing fix)
#
	if( ($album_config['thumbnail_cache'] == 1) and ($album_config['gd_version'] > 0) )
	{
		$gd_errored = false;

	switch ($pic_filetype)
	{
		case '.jpg':
			$read_function = 'imagecreatefromjpeg';
			break;
		case '.png':
			$read_function = 'imagecreatefrompng';
			break;
		case '.gif':
			$read_function = 'imagecreatefromgif';
			break;
	}

#
#-----[ FIND ]---------------------------------------- (GIF Thumbnailing fix)
#
			// Write to disk
			switch ($pic_filetype)
			{
				case '.jpg':
					@imagejpeg($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail, $album_config['thumbnail_quality']);
					break;
				case '.png':
					@imagepng($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail);
					break;
			}

#
#-----[ REPLACE WITH ]------------------------------------------ (GIF Thumbnailing fix)
#
			// Write to disk
			switch ($pic_filetype)
			{
				case '.jpg':
					@imagejpeg($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail, $album_config['thumbnail_quality']);
					break;
				case '.png':
					@imagepng($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail);
					break;
				case '.gif':
					@imagegif($thumbnail, ALBUM_CACHE_PATH . $pic_thumbnail);
					break;
			}

#
#----[ SAVE AND CLOSE ]-------------------------------
